<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="/static/css/icon.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/weui.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/weui2.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/style.css"/>
    <script src="/static/js/jquery-2.1.0.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/zepto.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/picker.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/highcharts.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/vue.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/all.js?v=2" type="text/javascript" charset="utf-8"></script>
</head>
<body>
<style>
    .nav_right {
        float: right;
        position: absolute;
        right: 0px;
    }

    .nav_right span, .nav_right a {
        font-size: 13px;
        color: #fff;
    }
</style>
<div id="content">
    <div class="topBox">
        <div class="indexTop" style="padding: 10px 0px;">

            <div class="total">
                <div class="nav_right">
                    {% if user %}
                        <span>{{ user.get("UserName") }} </span>
                        <a href="/logout">&nbsp;&nbsp;退出</a>
                        <a href="/set.html">&nbsp;&nbsp;设置</a>
                    {% endif %}
                </div>
                <label class="ysze"> {{ home_page_data['主营业数据']['应收总额'] }}</label>

                <p>应收总额</p>
            </div>

        </div>
        <ul class="summary">
            <li class="yjje">已结金额：{{ home_page_data['主营业数据']['已结金额'] }}</li>
            <li class="wjje">未结金额：{{ home_page_data['主营业数据']['未结金额'] }}</li>
            <li class="rjxf">人均消费：{{ home_page_data['主营业数据']['人均消费'] }}</li>
        </ul>
    </div>

</div>
<script type="text/javascript">
    $(function () {
        var delay={{ config.get("AJAX_REQUEST_DELAY") }};
        window.onload = function () {
            update_data()
        }


        function update_data() {


            $.ajax({
                url: '/get_top_data',
                type: 'get',
                data: {
                    "shop_id": "{{ shop_id }}"
                },
                success: function (data) {

                    if (data.status) {

                        $(".ysze").text(data['应收总额']);
                        $(".yjje").text(data['已结金额'])
                        $(".wjje").text(data['未结金额'])
                        $(".rjxf").text(data['人均消费']);

                    }


                },
                error: function () {

                }
            });
            setTimeout(update_data, delay);
        }
    })
</script>
</body>
</html>
